/* STATUS FROM FIGHTING? REASSESSING THE RELATIONSHIP BETWEEN CONFLICT INVOLVEMENT AND DIPLOMATIC RANK */

/* All results were generated using Stata 15.1 */

/* The data set for this paper is from Jonathan Renshon's analyses of the status benefits of fighting, and can be found at https://www.dropbox.com/s/ejjmvsz2oc3piui/Status%20Deficits%20and%20War%20Replication.zip?dl=0 */

cd "/Users/smw347/Desktop/Statusfromfighting"
use "./Data/status_benefits_data.dta"

/* Generate log-transformed CINC variable */

gen log_cinc = ln(cap)

/* Setting graphics font to Garamond */

 graph set window fontface "Garamond"

/* MAIN TEXT */

/* Table 1 - replicating Renshon's full results for MID initiation (uses the user-written Stata package outreg2) */

regress delta5_pr_overall_rank_A mzinit
est store Renshon_Init5_Bi
regress delta5_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Init5_GDP
regress delta10_pr_overall_rank_A mzinit
est store Renshon_Init10_Bi
regress delta10_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Init10_GDP

outreg2 [Renshon_Init5_Bi Renshon_Init5_GDP Renshon_Init10_Bi Renshon_Init10_GDP] using NWFTable1.xls, replace alpha(0.001, 0.01, 0.05)


/* Table 2 - replicating Renshon's full results for MID victory (uses the user-written Stata package outreg2) */

regress delta5_pr_overall_rank_A winlevel1 
est store Renshon_Win5_Bi
regress delta5_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Win5_GDP
regress delta10_pr_overall_rank_A winlevel1 
est store Renshon_Win10_Bi
regress delta10_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Win10_GDP

outreg2 [Renshon_Win5_Bi Renshon_Win5_GDP Renshon_Win10_Bi Renshon_Win10_GDP] using NWFTable2.xls, replace alpha(0.001, 0.01, 0.05)


/* Figure 1 - visualizing the distribution of CINC and CINC(ln), and their relationships with change in diplomatic rank */

gen SAF_1988 = 1 if ccode1 == 560 & year == 1988

gen SAF_1988_delta_ten = delta10_pr_overall_rank_A if SAF_1988 ==1

gen USA_1951 = 1 if ccode1 == 2 & year == 1951

gen USA_1951_delta_ten = delta10_pr_overall_rank_A if USA_1951 ==1

gen HAI_1960 =1 if ccode1 == 41 & year == 1960

gen HAI_1960_delta_ten = delta10_pr_overall_rank_A if HAI_1960 ==1

gen INS_1975 = 1 if ccode1 ==850 & year == 1975

gen INS_1975_delta_ten = delta10_pr_overall_rank_A if INS_1975 ==1

gen TAW_1995 = 1 if ccode1 == 713 & year == 1995

gen TAW_1995_delta_ten = delta10_pr_overall_rank_A if TAW_1995 ==1

gen TUR_1988 = 1 if ccode1 == 640 & year == 1988

gen TUR_1988_delta_ten = delta10_pr_overall_rank_A if TUR_1988 ==1

gen ccode_year_1 = "South Africa 1988" if SAF_1988 ==1

replace ccode_year_1 = "USA 1951" if USA_1951 ==1

replace ccode_year_1 = "Haiti 1960" if HAI_1960 ==1

replace ccode_year_1 = "Indonesia 1975" if INS_1975 ==1

replace ccode_year_1 = "Taiwan 1995" if TAW_1995 ==1

replace ccode_year_1 = "Turkey 1988" if TUR_1988 == 1

gen pos = 3

replace pos = 6 if USA_1951 ==1

hist cap, percent lw(vthin) fxsize(68) fysize(25) scheme(s1mono) saving (hist_cap, replace) ytitle("% of obs.", size(small)) ylabel(, labsize(small)) xtitle("CINC score", size(small)) xlabel(, labsize(small))

hist log_cinc, percent lw(vthin) fysize(25) scheme(s1mono) saving (hist_log_cinc, replace) ytitle("") yscale(alt) ylabel(, labsize(small)) xtitle("CINC(ln)", size(small)) xlabel(, labsize(small))

twoway (scatter delta10_pr_overall_rank_A SAF_1988_delta_ten USA_1951_delta_ten HAI_1960_delta_ten INS_1975_delta_ten TAW_1995_delta_ten TUR_1988_delta_ten cap, mcolor(gs9%40 black black black black black black) msymbol(p p p p p p p) mlabel(ccode_year_1) mlabsize(tiny) mlabv(pos)) (lfit delta10_pr_overall_rank_A cap, lcolor(black) lpattern(dash) lwidth(thin)) (lowess delta10_pr_overall_rank_A cap, bw(0.1) lcolor(black)), fxsize(68) scheme(s1mono) graphr(color(white)) legend(off) ylabel(, labsize(small)) xscale(alt) xlabel(none) ytitle("Change in diplomatic rank (ten years)", size(small)) xtitle("", size(small)) saving(line_lowess, replace)

twoway (scatter delta10_pr_overall_rank_A SAF_1988_delta_ten USA_1951_delta_ten HAI_1960_delta_ten INS_1975_delta_ten TAW_1995_delta_ten TUR_1988_delta_ten log_cinc, mcolor(gs9%40 black black black black black black) msymbol(p p p p p p p) mlabel(ccode_year_1) mlabsize(tiny) mlabv(pos)) (lfit delta10_pr_overall_rank_A log_cinc, lcolor(black) lpattern(dash) lwidth(thin)) (lowess delta10_pr_overall_rank_A log_cinc, bw(3) lcolor(black)), scheme(s1mono) graphr(color(white)) legend(off) ytitle("", size(small)) xscale(alt) xlabel(none) ylabel(, labsize(small)) yscale(alt) xtitle("", size(small)) saving(log_line_lowess, replace)

gr combine line_lowess.gph log_line_lowess.gph hist_cap.gph hist_log_cinc.gph, rows(2) scheme(s1mono) imargin(0 0 0 0) title("{bf:Figure 1:} Non-linearity in the relationship between CINC and change in diplomatic rank", size(medsmall) pos(7) span) note("Note: Upper panels are scatter plots with linear (dashed) and locally smoothed (solid) fits for the relationship between CINC (top left), the natural logarithm of CINC" "(top right), and change in diplomatic rank over ten years. Bottom panels show histograms of CINC (on the left) and CINC(ln) (on the right). Locally smoothed fits use" "bandwidth of 0.1(for CINC) and 3(for logged CINC).", size(vsmall) span)


/* Figure 2 - visualizing change in leverage and residuals when CINC is log-transformed */

regress delta10_pr_overall_rank_A cap pr_overall_rank_A

predict resid_cap, residual

gen abs_resid_cap = abs(resid_cap)

gen squ_resid_cap = resid_cap^2

predict leverage_cap, leverage

regress delta10_pr_overall_rank_A log_cinc pr_overall_rank_A

predict resid_log, residual

gen abs_resid_log = abs(resid_log)

gen squ_resid_log = resid_log^2

predict leverage_log, leverage

gen resid_change = resid_log - resid_cap

gen abs_resid_change = abs_resid_log - abs_resid_cap

gen squ_resid_change = squ_resid_log - squ_resid_cap

gen lev_change = leverage_log - leverage_cap

list lev_change if SAF_1988==1

list lev_change if INS_1975 ==1

list lev_change if TAW_1995 ==1

list lev_change if TUR_1988 ==1

list lev_change if HAI_1960 ==1

list lev_change if USA_1951 ==1

list abs_resid_change if SAF_1988==1

list abs_resid_change if INS_1975 ==1

list abs_resid_change if TAW_1995 ==1

list abs_resid_change if TUR_1988 ==1
 
list abs_resid_change if HAI_1960 ==1

list abs_resid_change if USA_1951 ==1

scatter leverage_cap leverage_log cap, msymbol(o X) mcolor(gs4 gs8%50) scheme(s1mono) text(.0045 .1 "{bf:Leverage differences:}" "South Africa 1988 = .00045" "Indonesia 1975 = .00085" "Taiwan 1995 = .00051" "Turkey 1988 = .00027" "Haiti 1960 = .00007" "USA 1951 = -.00449", j(left) size(small)) fysize(37) xlabel(none) xtitle("") xscale(alt) legend(label(1 "CINC") label(2 "CINC(ln)") pos(11) ring(0)) ylabel( ,labsize(vsmall)) ytitle(, size(small)) saving(leverage_2, replace)

scatter squ_resid_change cap, mcolor(gs4%30) msymbol(oh) mlwidth(medium) scheme(s1mono) yline(0, lpattern(dash) lwidth(thin)) text(700 .286 "MSE{sub:CINC} = 227.7", size(small)) text(400 .2875 " MSE{sub:CINC(ln)} = 216.4", size(small)) text(-700 .3 "{bf:Residual differences:}" "South Africa 1988 = -7.47" "Indonesia 1975 = -10.22" "Taiwan 1995 = -7.93" "Turkey 1988 = -5.83" "Haiti 1960 = -3.01" "USA 1951 =  1.20", j(left) size(small)) ytitle("Difference in squared residual", size(small)) xtitle(, size(small)) ylabel(, labsize(vsmall)) xlabel(, labsize(small)) saving(residual, replace)

gr combine leverage_2.gph residual.gph, scheme(s1mono) cols(1) imargin(0 0 0 0) xcommon title("{bf:Figure 2:} Leverage and change in squared residuals with CINC and log-transformed CINC", size(medsmall) pos(7) span) note("Note: Upper panel's y-axis reports each observation's leverage in bivariate models using CINC and CINC(ln) to predict change in diplomatic rank over ten years. The" "lower panel's y-axis reports the differences in the squared residual for each observation when CINC(ln) is used to predict change in diplomatic rank over ten years," "versus when CINC is used. Negative (positive) values along this axis mean that the squared residual decreases (increases) when CINC is log-transformed. Both values" "are plotted against CINC score on the x-axis. A reference line at y=0 is included in the lower panel, as are changes in the size of residuals and leverage values for the" "six observations highlighted in Figure 1. The lower panel also reports the mean squared error from the CINC model and CINC(ln) model.", size(vsmall) span)


/* Figure 3 - establishing that the effect of MID initiation on change in diplomatic rank varies substantially across the distribution of CINC */

regress delta10_pr_overall_rank_A i.mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl mzinit#c.cap

margins, dydx(mzinit) at(cap=(.00(.02).38)) at(majpow=0 geo4=1 geo2=0 geo3=0 geo5=0 (median) rgdpl (mean) polity2)

marginsplot, title("") saving (mfxcap, replace) scheme(s1mono) graphr(color(white)) yline(0, lpattern(dash) lwidth(thin)) recast(line) recastci(rline) ciopts(lpattern(dot) lwidth(thick)) xlabel(none) ylabel(, labsize(vsmall)) ytitle("Effect of MID initiation on change in diplomatic rank", size(vsmall)) xtitle("") xscale(alt)

hist cap, percent lw(vthin) fysize(30) scheme(s1mono) saving (hist_cap, replace) ytitle("% of obs.", size(vsmall)) ylabel(, labsize(vsmall)) xtitle("CINC score", size(vsmall)) xlabel(0(.04).4, labsize(vsmall))

gr combine mfxcap.gph  hist_cap.gph, col(1) imargin(0 0 0 0) scheme(s1mono) note("Note: Upper panel shows the marginal effect of MID initiation (as well as the 95% confidence interval) on change in diplomatic rank after ten years, across various" "levels of CINC. Estimates come from a model that replicates the 'full' model in the right-hand column of Table 1, but with an interaction term between CINC" "and MID initiation (b= -61.1, p= .008). Bottom panel shows a histogram of CINC.", size(vsmall) span) title("{bf:Figure 3:} Marginal effect of MID initiation on change in diplomatic rank, by CINC", size(medsmall) pos(7))


/* Figure 4 - comparing coefficients from models that use CINC and CINC(ln) (uses the user-written Stata package coefplot) */

regress delta5_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Init_5
regress delta5_pr_overall_rank_A mzinit polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Init_5
regress delta10_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Init_10
regress delta10_pr_overall_rank_A mzinit polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Init_10

regress delta5_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Win_5
regress delta5_pr_overall_rank_A winlevel1 polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Win_5
regress delta10_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Win_10
regress delta10_pr_overall_rank_A winlevel1 polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Win_10

coefplot (Renshon_Init_5, label(CINC, five years) msymbol(D) mcolor(gs10)) (log_cinc_Init_5, label(CINC(ln), five years) msymbol(D) mcolor(black)) (Renshon_Init_10, label(CINC, ten years) msymbol(S) mcolor(gs10)) (log_cinc_Init_10, label(CINC(ln), ten years) msymbol(S) mcolor(black)), text(0.7 4 "{it:R{superscript:2}} = .035", fcolor(white) lcolor(black)) text(0.9 3 "{it:R{superscript:2}} = .065", fcolor(white) lcolor(black)) text(1.1 5.8 "{it:R{superscript:2}} = .065", fcolor(white) lcolor(black)) text(1.3 3.8 "{it:R{superscript:2}} = .13", fcolor(white) lcolor(black)) scheme(s1mono) level (95) ciopts (recast(rcap) lcolor(black) lwidth(thin)) xline(0, lpattern(dash) lcolor(black) lwidth(thin)) drop (_cons) keep (mzinit) rename (mzinit = "MID initiation") ylabel(none) xlabel(none) xscale(alt) legend(off) title("MID initiation", size(medsmall) ring(0) pos(7)) saving(init_coefplot, replace)

coefplot (Renshon_Win_5, label(CINC, five years) msymbol(D) mcolor(gs10)) (log_cinc_Win_5, label(CINC(ln), five years) msymbol(D) mcolor(black)) (Renshon_Win_10, label(CINC, ten years) msymbol(S) mcolor(gs10)) (log_cinc_Win_10, label(CINC(ln), ten years) msymbol(S) mcolor(black)), fysize(49) text(0.7 0.8 "{it:R{superscript:2}} = .036", fcolor(white) lcolor(black)) text(0.9 -1 "{it:R{superscript:2}} = .064", fcolor(white) lcolor(black)) text(1.1 -3.2 "{it:R{superscript:2}} = .06", fcolor(white) lcolor(black)) text(1.3 8.3 "{it:R{superscript:2}} = .12", fcolor(white) lcolor(black)) scheme(s1mono) level (95) ciopts (recast(rcap) lcolor(black) lwidth(thin)) xline(0, lpattern(dash) lcolor(black) lwidth(thin)) drop (_cons) keep (winlevel1) rename (winlevel1 = "MID victory") ylabel(none) xlabel(-5(1)10) legend(pos(5)) title("MID victory", size(medsmall) ring(0) pos(11)) saving(win_coefplot, replace)

gr combine init_coefplot.gph win_coefplot.gph, cols(1) xcommon imargin (0 0 0 0) scheme(s1mono) title("{bf:Figure 4:} Comparing conflict coefficients in models with CINC and CINC(ln)", size(medsmall) pos(7) span) note("Note: Top panel displays coefficients for MID initiation from four multivariate OLS regression models, with results from models replacing CINC with CINC(ln) in" "black. Bottom panel displays coefficients on MID victory from models specified in the same manner. Coefficients in gray replicate results from Renshon's fully" "specified models from Tables 1 and 2. Bars represent 95% confidence intervals. R-squared for each model reported to compare goodness of fit.", size(vsmall) span)


/* Figure 5 - analyzing changes in influence when CINC is log-transformed */

regress delta10_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl

dfbeta

gen dfbeta_cinc = _dfbeta_3

gen dfbeta_cap = _dfbeta_1

drop _dfbeta_1 - _dfbeta_10

regress delta10_pr_overall_rank_A mzinit polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl

dfbeta

gen dfbeta_LOG = _dfbeta_3

gen dfbeta_log_cinc = _dfbeta_1

drop _dfbeta_1 - _dfbeta_10

gen dfbeta_diff = dfbeta_log_cinc - dfbeta_cap

gen dfbeta_diff_CINC = dfbeta_LOG - dfbeta_cinc

gen dfbeta_diff_SAF_1988 = dfbeta_diff if SAF_1988 ==1

gen dfbeta_diff_INS_1975 = dfbeta_diff if INS_1975 ==1

gen dfbeta_diff_TAW_1995 = dfbeta_diff if TAW_1995 ==1

gen dfbeta_diff_TUR_1988 = dfbeta_diff if TUR_1988 ==1

gen ccode_year_inf = "South Africa 1988" if SAF_1988 ==1

replace ccode_year_inf = "Indonesia 1975" if INS_1975 ==1

replace ccode_year_inf = "Taiwan 1995" if TAW_1995 ==1

replace ccode_year_inf = "Turkey 1988" if TUR_1988 ==1

gen pos2 =3

replace pos2 = 6 if SAF_1988 ==1

scatter dfbeta_diff dfbeta_diff_SAF_1988 dfbeta_diff_INS_1975 dfbeta_diff_TAW_1995 dfbeta_diff_TUR_1988 cap, fxsize(68) ytitle("Change in observation influence on MID initiation coefficient", size(small)) ylabel(, labsize(small)) xlabel(,labsize(small)) legend(off) xtitle(, size(small)) yline(0, lpattern(dash) lwidth(thin)) msymbol(o o o o o) mcolor(gs8%40 black black black black) mlwidth(none none none none none) mlab(ccode_year_inf) scheme(s1mono) saving(Influence_1, replace)

twoway (scatter dfbeta_diff dfbeta_diff_SAF_1988 dfbeta_diff_INS_1975 dfbeta_diff_TAW_1995 dfbeta_diff_TUR_1988 dfbeta_diff_CINC, msymbol(o o o o o) mcolor(gs8%40 black black black black) mlwidth(none none none none none) mlab(ccode_year_inf) mlabv(pos2)) (lfit dfbeta_diff dfbeta_diff_CINC, lcolor(black)), text(-0.03 -.12 "{it:b} = -0.154""{it:r} = -0.586 ", fcolor(white) lcolor(black)) legend(off) ytitle("") yscale(alt) ylabel(none) xlabel(, labsize(small)) xtitle("Change in observation influence on capabilities coefficient", size(small)) scheme(s1mono) saving(Influence_2, replace)

gr combine Influence_1.gph Influence_2.gph, ycommon imargin(0 0 0 0) scheme(s1mono) title("{bf:Figure 5:} Differences in influence between models with CINC and CINC(ln)", size(medsmall) pos(7) span) note("Note: The y-axis plots the difference between each observation's influence on the ten-year MID initiation coefficient as estimated in the model containing CINC(ln)" "and the model containing the raw version of CINC. Negative values indicate that the observation's positive influence on the coefficient shrinks in the CINC(ln)" "model as compared to the CINC model. The panel on the left plots this value against each observation's CINC score, and includes a reference line at y=0. The panel" "on the right plots the same value against the difference in each observation's influence on the capabilities coefficient between CINC and CINC(ln) models. Positive" "values indicate that the observation's positive influence on the capabilities coefficient is larger in the CINC(ln) model than in the CINC model. Solid line represents" "a linear fit.", size(vsmall) span)


/* Figure 6 - comparing linear and log-linear models to more flexible approaches to addressing non-linearity (uses the user-written Stata package pspline)*/

regress delta10_pr_overall_rank_A cap mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

cprplot cap, scheme(s1mono) text(-150 0.27 "Coef. on MID init. = 2.7 (se=.78)""AIC=39317.86; BIC=39388.59", fcolor(white) margin(vsmall) size(vsmall)) ylabel(, labsize(vsmall)) ytitle ("Change in diplomatic rank", size(small)) yscale(titlegap(*.5)) msymbol(p) mcolor(gs9%40) xlabel(0(.1).4, labsize(vsmall)) xtitle("CINC score", size(small)) xscale(alt) saving(linear_cpr, replace) title("Linear", size(small) ring(0) pos(12))

regress delta10_pr_overall_rank_A log_cinc mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

cprplot log_cinc, scheme(s1mono) text(-150 -10 "Coef. on MID init. = .696 (se=.76)""AIC=38972.04; BIC=39042.78", fcolor(white) margin(vsmall) size(vsmall)) ylabel(, labsize(vsmall)) ytitle ("Change in diplomatic rank", size(small)) yscale(titlegap(*.5)) msymbol(p) xlabel(-15(5)0, labsize(vsmall)) xtitle("CINC(ln)", size(small)) mcolor(gs9%40) title("Log-linear", size(small) ring(0) pos(12)) saving(logged_cpr, replace)

fp <cap>, replace: regress delta10_pr_overall_rank_A mzinit polity2 <cap> pr_overall_rank_A geo2-geo5 majpow rgdpl

fp plot, residuals(residuals) fxsize(43) text(-150 0.27 "Coef. on MID init. = .753 (se=.76)""AIC=38957.97; BIC=39035.13", fcolor(white) margin(vsmall) size(vsmall)) ytitle("") ylabel(none) xlabel(, labsize(vsmall)) xtitle("CINC score", size(small)) scheme(s1mono) plotopts(msymbol(p) mcolor(gs9%40) recast(rline)) xscale(alt) ciop(fi(0) recast(rline) lpattern(dash) lcolor(black) lwidth(none)) title("Fractional polynomial", size(small) ring(0) pos(12)) saving(fracpoly, replace)

fp <log_cinc>, scale replace: regress delta10_pr_overall_rank_A mzinit polity2 <log_cinc> pr_overall_rank_A geo2-geo5 majpow rgdpl

fp plot, fxsize(43) residuals(residuals) ytitle("") xtitle("CINC(ln)", size(small)) xlabel(, labsize(vsmall)) text(-150 -10 "Coef. on MID init. = .687 (se=.76)""AIC=38944.07; BIC=39021.23", fcolor(white) margin(vsmall) size(vsmall)) ylabel(none) scheme(s1mono) plotopts(msymbol(p) mcolor(gs9%40) recast(rline)) ciop(fi(0) recast(rline) lpattern(dash) lcolor(black) lwidth(none)) title("Fractional polynomial with log-transformed CINC", size(small) ring(0) pos(12)) saving(fracpoly_logged, replace)

pspline delta10_pr_overall_rank_A cap mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, noknot fxsize(43) text(-150 0.27 "Coef. on MID init. = .518 (se=.76)""AIC=38992.22; BIC=39082.24", fcolor(white) margin(vsmall) size(vsmall)) ytitle("") ylabel(none) d(2) noisily msymbol(p) mcolor(gs9%40) xscale(alt) xtitle("CINC score", size(small)) xlabel(0(.1).4, labsize(vsmall)) lineopts(lcolor(black) lpattern(solid)) scheme(s1mono) title("Penalized spline", size(small) ring(0) pos(12)) saving(pspline, replace)

pspline delta10_pr_overall_rank_A log_cinc mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, noknot fxsize(43) ytitle("") xtitle("CINC(ln)", size(small)) text(-150 -10 "Coef. on MID init. = .538 (se=.76)""AIC= 38963.82; BIC=39053.84", fcolor(white) margin(vsmall) size(vsmall)) ylabel(none) d(2) noisily msymbol(p) mcolor(gs9%40) xlabel(-15(5)0, labsize(vsmall)) lineopts(lcolor(black) lpattern(solid)) scheme(s1mono) title("Penalized spline with log-transformed CINC", size(small) ring(0) pos(12)) saving(pspline_logged, replace)

gr combine linear_cpr.gph fracpoly.gph pspline.gph logged_cpr.gph fracpoly_logged.gph pspline_logged.gph, ycommon imargin(0 0 0 0 0 0) scheme(s1mono) title("{bf:Figure 6:} Modeling non-linearity in the CINC-diplomatic rank relationship", size(medsmall) pos(7)) note("Note: Graphs above depict the predicted values of change in diplomatic rank over ten years across different values of CINC, along with partial residuals, from six multivariate regression models. The linear graph is a component plus residual plot from" "Renshon's fully specified ten-year MID initiation model. The log-linear graph is a component plus residual plot from the same model, but with the log-transformed version of CINC replacing the raw version. Graphs in the center column show" "component plus residual plots from fractional polnynomial models (with the log-transformed version of CINC replacing the raw version in the graph on the bottom). Graphs in the right-hand column are component plus residual plots from" "penalized spline models, with the bottom graph again including the log-transformed version of CINC. Estimated coefficients for MID initiation from each model are also displayed. I also report the Aikake and Bayesian Information Criteria as" "measures of goodness of fit.", size(tiny) span)


/* Table 3 - comparing full results from different approaches to modeling non-linearity (uses the user-written Stata packages pspline and esttab) */

regress delta5_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Init5_GDP

regress delta5_pr_overall_rank_A mzinit polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Init_5

fp <cap>, replace: regress delta5_pr_overall_rank_A mzinit polity2 <cap> pr_overall_rank_A geo2-geo5 majpow rgdpl
est store fp_cap_5

fp <log_cinc>, scale replace: regress delta5_pr_overall_rank_A mzinit polity2 <log_cinc> pr_overall_rank_A geo2-geo5 majpow rgdpl
est store fp_log_cinc_5

pspline delta5_pr_overall_rank_A cap mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, nogr noisily d(2)
est store pspline_cap_5

pspline delta5_pr_overall_rank_A log_cinc mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, nogr noisily d(2)
est store pspline_log_cinc_5

regress delta10_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Init10_GDP

regress delta10_pr_overall_rank_A mzinit polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Init_10

fp <cap>, replace: regress delta10_pr_overall_rank_A mzinit polity2 <cap> pr_overall_rank_A geo2-geo5 majpow rgdpl
est store fp_cap_10

fp <log_cinc>, scale replace: regress delta10_pr_overall_rank_A mzinit polity2 <log_cinc> pr_overall_rank_A geo2-geo5 majpow rgdpl
est store fp_log_cinc_10

pspline delta10_pr_overall_rank_A cap mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, nogr noisily d(2)
est store pspline_cap_10

pspline delta10_pr_overall_rank_A log_cinc mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, nogr noisily d(2)
est store pspline_log_cinc_10

regress delta5_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_win5_GDP

regress delta5_pr_overall_rank_A winlevel1 polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_win_5

fp <cap>, replace: regress delta5_pr_overall_rank_A winlevel1 polity2 <cap> pr_overall_rank_A geo2-geo5 majpow rgdpl
est store fp_cap_5_win

fp <log_cinc>, scale replace: regress delta5_pr_overall_rank_A winlevel1 polity2 <log_cinc> pr_overall_rank_A geo2-geo5 majpow rgdpl
est store fp_log_cinc_5_win

pspline delta5_pr_overall_rank_A cap winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, nogr noisily d(2)
est store pspline_cap_5_win

pspline delta5_pr_overall_rank_A log_cinc winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, nogr noisily d(2)
est store pspline_log_cinc_5_win

regress delta10_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_win10_GDP

regress delta10_pr_overall_rank_A winlevel1 polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_win_10

fp <cap>, replace: regress delta10_pr_overall_rank_A winlevel1 polity2 <cap> pr_overall_rank_A geo2-geo5 majpow rgdpl
est store fp_cap_10_win

fp <log_cinc>, scale replace: regress delta10_pr_overall_rank_A winlevel1 polity2 <log_cinc> pr_overall_rank_A geo2-geo5 majpow rgdpl
est store fp_log_cinc_10_win

pspline delta10_pr_overall_rank_A cap winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, nogr noisily d(2)
est store pspline_cap_10_win

pspline delta10_pr_overall_rank_A log_cinc winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, nogr noisily d(2)
est store pspline_log_cinc_10_win

esttab Renshon_Init5_GDP log_cinc_Init_5 fp_cap_5 fp_log_cinc_5 pspline_cap_5 pspline_log_cinc_5 using Coefficient_table.csv, nogaps nonotes coeflabels(mzinit "Initiation (5 years)") title ("Table 3: Coefficients on conflict indicator from six approaches to modeling the role of CINC") eqlabels("") replace nonumbers keep(mzinit) se stats(aic bic) noli mtitles("Linear" "Linear (ln CINC)" "Fractional polynomial" "Frac. poly. (ln CINC)" "P-spline" "P-spline (ln CINC)")

esttab Renshon_Init10_GDP log_cinc_Init_10 fp_cap_10 fp_log_cinc_10 pspline_cap_10 pspline_log_cinc_10 using Coefficient_table.csv, nogaps nonotes append coeflabels(mzinit "Initiation (10 years)") eqlabels("") nonumbers se keep(mzinit) stats(aic bic) noli nomti

esttab Renshon_win5_GDP log_cinc_win_5 fp_cap_5_win fp_log_cinc_5_win pspline_cap_5_win pspline_log_cinc_5_win using Coefficient_table.csv, nogaps nonotes append coeflabels(winlevel1 "Victory (5 years)") eqlabels("") nonumbers se keep(winlevel1) stats(aic bic) noli nomti

esttab Renshon_win10_GDP log_cinc_win_10 fp_cap_10_win fp_log_cinc_10_win pspline_cap_10_win pspline_log_cinc_10_win using Coefficient_table.csv, nogaps append coeflabels(winlevel1 "Victory (10 years)") eqlabels("") nonumbers se keep(winlevel1) stats(aic bic) noli nomti addnotes("The Aikake and Bayesian Information Criteria are reported for each model as measures of goodness of fit.")

/* APPENDIX */


/* Figure 1A - replicates Figure 1 for change in diplomatic rank over ten years */

twoway (scatter delta5_pr_overall_rank_A cap, mcolor(gs9%40) msymbol(p)) (lfit delta5_pr_overall_rank_A cap, lcolor(black) lpattern(dash) lwidth(thin)) (lowess delta5_pr_overall_rank_A cap, bw(0.1) lcolor(black)), fxsize(68) scheme(s1mono) graphr(color(white)) legend(off) ylabel(, labsize(small)) xlabel(, labsize(small)) ytitle("Change in diplomatic rank (five years)", size(small)) xtitle("CINC score", size(small)) saving(line_lowess, replace)

twoway (scatter delta5_pr_overall_rank_A log_cinc, mcolor(gs9%40) msymbol(p)) (lfit delta5_pr_overall_rank_A log_cinc, lcolor(black) lpattern(dash) lwidth(thin)) (lowess delta5_pr_overall_rank_A log_cinc, bw(3) lcolor(black)), scheme(s1mono) graphr(color(white)) legend(off) ytitle("", size(small)) xlabel(, labsize(small)) ylabel(, labsize(small)) yscale(alt) xtitle("CINC(ln)", size(small)) saving(log_line_lowess, replace)

gr combine line_lowess.gph log_line_lowess.gph, rows(1) scheme(s1mono) imargin(0 0 0 0) title("{bf:Figure 1A:} Non-linearity in the relationship between CINC and change in diplomatic rank", size(small) pos(7) span) note("Note: Upper panels are scatter plots with linear (dashed) and locally smoothed (solid) fits for the relationship between CINC (top left), the natural logarithm of CINC" "(top right), and change in diplomatic rank over five years. Locally smoothed fits use bandwidth of 0.1(for CINC) and 3(for logged CINC).", size(vsmall) span)


/* Figure 2A - replicates Figure 2 for change in diplomatic rank over five years */

regress delta5_pr_overall_rank_A cap pr_overall_rank_A

predict resid_cap_five, residual

gen squ_resid_cap_five = resid_cap_five^2

predict leverage_cap_five, leverage

regress delta5_pr_overall_rank_A log_cinc pr_overall_rank_A

predict resid_log_five, residual

gen squ_resid_log_five = resid_log_five^2

predict leverage_log_five, leverage

gen resid_change_five = resid_log_five - resid_cap_five

gen squ_resid_change_five = squ_resid_log_five - squ_resid_cap_five

gen lev_change_five = leverage_log_five - leverage_cap_five


scatter leverage_cap_five leverage_log_five cap, msymbol(o X) mcolor(gs4 gs8%50) scheme(s1mono) fysize(37) xlabel(none) xtitle("") xscale(alt) legend(label(1 "CINC") label(2 "CINC(ln)") pos(11) ring(0)) ylabel( ,labsize(vsmall)) ytitle(, size(small)) saving(leverage_2_five, replace)

scatter squ_resid_change_five cap, mcolor(gs4%30) msymbol(oh) mlwidth(medium) scheme(s1mono) yline(0, lpattern(dash) lwidth(thin)) text(-200 .286 "MSE{sub:CINC} = 119.46", size(small)) text(-400 .2875 " MSE{sub:CINC(ln)} = 116.45", size(small)) ytitle("Difference in squared residual", size(small)) xtitle(, size(small)) ylabel(, labsize(vsmall)) xlabel(, labsize(small)) saving(residual_five, replace)

gr combine leverage_2_five.gph residual_five.gph, scheme(s1mono) cols(1) imargin(0 0 0 0) xcommon title("{bf:Figure 2A:} Leverage and change in squared residuals with CINC and log-transformed CINC", size(medsmall) pos(7) span) note("Note: Upper panel's y-axis reports each observation's leverage in bivariate models using CINC and CINC(ln) to predict change in diplomatic rank over five years. The" "lower panel's y-axis reports the differences in the squared residual for each observation when CINC(ln) is used to predict change in diplomatic rank over five years," "versus when CINC is used. Negative (positive) values along this axis mean that the squared residual decreases (increases) when CINC is log-transformed. Both values" "are plotted against CINC score on the x-axis. A reference line at y=0 is included in the lower panel. The lower panel also reports the mean squared error from the" "CINC model and CINC(ln) model.", size(vsmall) span)


/* Figure 3A - replicates Figure 3 for the effect of MID initiation on change in diplomatic rank over five years */

regress delta5_pr_overall_rank_A i.mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl mzinit#c.cap

margins, dydx(mzinit) at(cap=(.00(.02).38)) at(majpow=0 geo4=1 geo2=0 geo3=0 geo5=0 (median) rgdpl (mean) polity2)

marginsplot, title("") saving (mfxcap5, replace) scheme(s1mono) graphr(color(white)) yline(0, lpattern(dash) lwidth(thin)) recast(line) recastci(rline) ciopts(lpattern(dot) lwidth(thick)) xlabel(none) ylabel(, labsize(vsmall)) ytitle("Effect of MID initiation on change in diplomatic rank", size(vsmall)) xtitle("") xscale(alt)

hist cap, percent lw(vthin) fysize(30) scheme(s1mono) saving (hist_cap, replace) ytitle("% of obs.", size(vsmall)) ylabel(, labsize(vsmall)) xtitle("CINC score", size(vsmall)) xlabel(0(.04).4, labsize(vsmall))

gr combine mfxcap5.gph  hist_cap.gph, col(1) imargin(0 0 0 0) scheme(s1mono) note("Note: Upper panel shows the marginal effect of MID initiation (as well as the 95% confidence interval) on change in diplomatic rank after five years, across various" "levels of CINC. Estimates come from a model that replicates the 'full' model in the left-hand column of Table 1, but with an interaction term between CINC" "and MID initiation. Bottom panel shows a histogram of CINC.", size(vsmall) span) title("{bf:Figure 3A:} Marginal effect of MID initiation on change in diplomatic rank, by CINC", size(small) pos(7))


/* Figure 4A - replicates Figure 3 for the effect of MID victory on change in diplomatic rank over five years */

regress delta5_pr_overall_rank_A i.winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl winlevel1#c.cap

margins, dydx(winlevel1) at(cap=(.00(.02).38)) at(majpow=0 geo4=1 geo2=0 geo3=0 geo5=0 (median) rgdpl (mean) polity2)

marginsplot, title("") saving (mfxcapwin5, replace) scheme(s1mono) graphr(color(white)) yline(0, lpattern(dash) lwidth(thin)) recast(line) recastci(rline) ciopts(lpattern(dot) lwidth(thick)) xlabel(none) ylabel(, labsize(vsmall)) ytitle("Effect of MID victory on change in diplomatic rank", size(vsmall)) xtitle("") xscale(alt)

hist cap, percent lw(vthin) fysize(30) scheme(s1mono) saving (hist_cap, replace) ytitle("% of obs.", size(vsmall)) ylabel(, labsize(vsmall)) xtitle("CINC score", size(vsmall)) xlabel(0(.04).4, labsize(vsmall))

gr combine mfxcapwin5.gph  hist_cap.gph, col(1) imargin(0 0 0 0) scheme(s1mono) note("Note: Upper panel shows the marginal effect of MID victory (as well as the 95% confidence interval) on change in diplomatic rank after five years, across various" "levels of CINC. Estimates come from a model that replicates the 'full' model in the left-hand column of Table 2, but with an interaction term between CINC" "and MID victory. Bottom panel shows a histogram of CINC.", size(vsmall) span) title("{bf:Figure 4A:} Marginal effect of MID victory on change in diplomatic rank, by CINC", size(small) pos(7))


/* Figure 5A - replicates Figure 3 for the effect of MID victory on change in diplomatic rank over ten years */

regress delta10_pr_overall_rank_A i.winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl winlevel1#c.cap

margins, dydx(winlevel1) at(cap=(.00(.02).38)) at(majpow=0 geo4=1 geo2=0 geo3=0 geo5=0 (median) rgdpl (mean) polity2)

marginsplot, title("") saving (mfxcapwin10, replace) scheme(s1mono) graphr(color(white)) yline(0, lpattern(dash) lwidth(thin)) recast(line) recastci(rline) ciopts(lpattern(dot) lwidth(thick)) xlabel(none) ylabel(, labsize(vsmall)) ytitle("Effect of MID victory on change in diplomatic rank", size(vsmall)) xtitle("") xscale(alt)

hist cap, percent lw(vthin) fysize(30) scheme(s1mono) saving (hist_cap, replace) ytitle("% of obs.", size(vsmall)) ylabel(, labsize(vsmall)) xtitle("CINC score", size(vsmall)) xlabel(0(.04).4, labsize(vsmall))

gr combine mfxcapwin10.gph  hist_cap.gph, col(1) imargin(0 0 0 0) scheme(s1mono) note("Note: Upper panel shows the marginal effect of MID victory (as well as the 95% confidence interval) on change in diplomatic rank after ten years, across various" "levels of CINC. Estimates come from a model that replicates the 'full' model in the right-hand column of Table 2, but with an interaction term between CINC" "and MID victory. Bottom panel shows a histogram of CINC.", size(vsmall) span) title("{bf:Figure 5A:} Marginal effect of MID victory on change in diplomatic rank, by CINC", size(small) pos(7))


/* Equality of coefficient test results displayed in Table 1A */

regress delta5_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Init_5
regress delta5_pr_overall_rank_A mzinit polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Init_5
regress delta10_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Init_10
regress delta10_pr_overall_rank_A mzinit polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Init_10

regress delta5_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Win_5
regress delta5_pr_overall_rank_A winlevel1 polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Win_5
regress delta10_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl
est store Renshon_Win_10
regress delta10_pr_overall_rank_A winlevel1 polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl
est store log_cinc_Win_10

suest Renshon_Init_5 log_cinc_Init_5
test [Renshon_Init_5_mean]mzinit = [log_cinc_Init_5_mean]mzinit

suest Renshon_Init_10 log_cinc_Init_10
test [Renshon_Init_10_mean]mzinit = [log_cinc_Init_10_mean]mzinit

suest Renshon_Win_5 log_cinc_Win_5
test [Renshon_Win_5_mean]winlevel1 = [log_cinc_Win_5_mean]winlevel1

suest Renshon_Win_10 log_cinc_Win_10
test [Renshon_Win_10_mean]winlevel1 = [log_cinc_Win_10_mean]winlevel1


/* Figure 6A - replicates Figure 5 for the relationship between MID initiation and change in diplomatic rank over five years */

regress delta5_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl

dfbeta

gen dfbeta_cinc_init5 = _dfbeta_3

gen dfbeta_cap_init5 = _dfbeta_1

drop _dfbeta_1 - _dfbeta_10

regress delta5_pr_overall_rank_A mzinit polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl

dfbeta

gen dfbeta_LOG_init5 = _dfbeta_3

gen dfbeta_log_cinc_init5 = _dfbeta_1

drop _dfbeta_1 - _dfbeta_10

gen dfbeta_diff_init5 = dfbeta_log_cinc_init5 - dfbeta_cap_init5

gen dfbeta_diff_CINC_init5 = dfbeta_LOG_init5 - dfbeta_cinc_init5

scatter dfbeta_diff_init5 cap, fxsize(68) ytitle("Change in observation influence on MID initiation coefficient", size(small)) ylabel(, labsize(small)) xlabel(,labsize(small)) legend(off) xtitle(, size(small)) yline(0, lpattern(dash) lwidth(thin)) msymbol(o) mcolor(gs8%40) mlwidth(none) scheme(s1mono) saving(Influence_1_init5, replace)

twoway (scatter dfbeta_diff_init5 dfbeta_diff_CINC_init5, msymbol(o) mcolor(gs8%40) mlwidth(none)) (lfit dfbeta_diff_init5 dfbeta_diff_CINC_init5, lcolor(black)), legend(off) ytitle("") yscale(alt) ylabel(none) xlabel(, labsize(small)) xtitle("Change in observation influence on capabilities coefficient", size(small)) scheme(s1mono) saving(Influence_2_init5, replace)

gr combine Influence_1_init5.gph Influence_2_init5.gph, ycommon imargin(0 0) scheme(s1mono) title("{bf:Figure 6A:} Distribution of changes in the influence of observations on conflict and capabilities coefficients", size(small) pos(7) span) note("Note: The y-axis plots the difference between each observation's influence on the five-year MID initiation coefficient as estimated in the model containing CINC(ln)" "and the model containing the raw version of CINC. Negative values indicate that the observation's positive influence on the coefficient shrinks in the CINC(ln)" "model as compared to the CINC model. The panel on the left plots this value against each observation's CINC score, and includes a reference line at y=0. The panel" "on the right plots the same value against the difference in each observation's influence on the capabilities coefficient between CINC and CINC(ln) models. Positive" "values indicate that the observation's positive influence on the capabilities coefficient is larger in the CINC(ln) model than in the CINC model. Solid line represents" "a linear fit.", size(vsmall) span)


/* Figure 7A - replicates Figure 5 for the relationship between MID victory and change in diplomatic rank over five years */

regress delta5_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl

dfbeta

gen dfbeta_cinc_win5 = _dfbeta_3

gen dfbeta_cap_win5 = _dfbeta_1

drop _dfbeta_1 - _dfbeta_10

regress delta5_pr_overall_rank_A winlevel1 polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl

dfbeta

gen dfbeta_LOG_win5 = _dfbeta_3

gen dfbeta_log_cinc_win5 = _dfbeta_1

drop _dfbeta_1 - _dfbeta_10

gen dfbeta_diff_win5 = dfbeta_log_cinc_win5 - dfbeta_cap_win5

gen dfbeta_diff_CINC_win5 = dfbeta_LOG_win5 - dfbeta_cinc_win5

scatter dfbeta_diff_win5 cap, fxsize(68) ytitle("Change in observation influence on MID victory coefficient", size(small)) ylabel(, labsize(small)) xlabel(,labsize(small)) legend(off) xtitle(, size(small)) yline(0, lpattern(dash) lwidth(thin)) msymbol(o) mcolor(gs8%40) mlwidth(none) scheme(s1mono) saving(Influence_1_win5, replace)

twoway (scatter dfbeta_diff_win5 dfbeta_diff_CINC_win5, msymbol(o) mcolor(gs8%40) mlwidth(none)) (lfit dfbeta_diff_win5 dfbeta_diff_CINC_win5, lcolor(black)), legend(off) ytitle("") yscale(alt) ylabel(none) xlabel(, labsize(small)) xtitle("Change in observation influence on capabilities coefficient", size(small)) scheme(s1mono) saving(Influence_2_win5, replace)

gr combine Influence_1_win5.gph Influence_2_win5.gph, ycommon imargin(0 0) scheme(s1mono) title("{bf:Figure 7A:} Distribution of changes in the influence of observations on conflict and capabilities coefficients", size(small) pos(7) span) note("Note: The y-axis plots the difference between each observation's influence on the five-year MID victory coefficient as estimated in the model containing CINC(ln)" "and the model containing the raw version of CINC. Negative values indicate that the observation's positive influence on the coefficient shrinks in the CINC(ln)" "model as compared to the CINC model. The panel on the left plots this value against each observation's CINC score, and includes a reference line at y=0. The panel" "on the right plots the same value against the difference in each observation's influence on the capabilities coefficient between CINC and CINC(ln) models. Positive" "values indicate that the observation's positive influence on the capabilities coefficient is larger in the CINC(ln) model than in the CINC model. Solid line represents" "a linear fit.", size(vsmall) span)


/* Figure 8A - replicates Figure 5 for the relationship between MID victory and change in diplomatic rank over ten years */

regress delta10_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl

dfbeta

gen dfbeta_cinc_win10 = _dfbeta_3

gen dfbeta_cap_win10 = _dfbeta_1

drop _dfbeta_1 - _dfbeta_10

regress delta10_pr_overall_rank_A winlevel1 polity2 log_cinc pr_overall_rank_A geo2-geo5 majpow rgdpl

dfbeta

gen dfbeta_LOG_win10 = _dfbeta_3

gen dfbeta_log_cinc_win10 = _dfbeta_1

drop _dfbeta_1 - _dfbeta_10

gen dfbeta_diff_win10 = dfbeta_log_cinc_win10 - dfbeta_cap_win10

gen dfbeta_diff_CINC_win10 = dfbeta_LOG_win10 - dfbeta_cinc_win10

scatter dfbeta_diff_win10 cap, fxsize(68) ytitle("Change in observation influence on MID victory coefficient", size(small)) ylabel(, labsize(small)) xlabel(,labsize(small)) legend(off) xtitle(, size(small)) yline(0, lpattern(dash) lwidth(thin)) msymbol(o) mcolor(gs8%40) mlwidth(none) scheme(s1mono) saving(Influence_1_win10, replace)

twoway (scatter dfbeta_diff_win10 dfbeta_diff_CINC_win10, msymbol(o) mcolor(gs8%40) mlwidth(none)) (lfit dfbeta_diff_win10 dfbeta_diff_CINC_win10, lcolor(black)), legend(off) ytitle("") yscale(alt) ylabel(none) xlabel(, labsize(small)) xtitle("Change in observation influence on capabilities coefficient", size(small)) scheme(s1mono) saving(Influence_2_win10, replace)

gr combine Influence_1_win10.gph Influence_2_win10.gph, ycommon imargin(0 0) scheme(s1mono) title("{bf:Figure 8A:} Distribution of changes in the influence of observations on conflict and capabilities coefficients", size(small) pos(7) span) note("Note: The y-axis plots the difference between each observation's influence on the ten-year MID victory coefficient as estimated in the model containing CINC(ln)" "and the model containing the raw version of CINC. Negative values indicate that the observation's positive influence on the coefficient shrinks in the CINC(ln)" "model as compared to the CINC model. The panel on the left plots this value against each observation's CINC score, and includes a reference line at y=0. The panel" "on the right plots the same value against the difference in each observation's influence on the capabilities coefficient between CINC and CINC(ln) models. Positive" "values indicate that the observation's positive influence on the capabilities coefficient is larger in the CINC(ln) model than in the CINC model. Solid line represents" "a linear fit.", size(vsmall) span)


/* Figure 9A - replicates Figure 6 for the relationship between MID initiation and change in diplomatic rank over five years */

regress delta5_pr_overall_rank_A cap mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

cprplot cap, scheme(s1mono) ylabel(, labsize(vsmall)) ytitle ("Change in diplomatic rank", size(small)) yscale(titlegap(*.5)) msymbol(p) mcolor(gs9%40) xlabel(0(.1).4, labsize(vsmall)) xtitle("CINC score", size(small)) xscale(alt) saving(linear_cpr_init5, replace) title("Linear", size(small) ring(0) pos(12))

regress delta5_pr_overall_rank_A log_cinc mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

cprplot log_cinc, scheme(s1mono) ylabel(, labsize(vsmall)) ytitle ("Change in diplomatic rank", size(small)) yscale(titlegap(*.5)) msymbol(p) xlabel(-15(5)0, labsize(vsmall)) xtitle("CINC(ln)", size(small)) mcolor(gs9%40) title("Log-linear", size(small) ring(0) pos(12)) saving(logged_cpr_init5, replace)


fp <cap>, replace: regress delta5_pr_overall_rank_A mzinit polity2 <cap> pr_overall_rank_A geo2-geo5 majpow rgdpl

fp plot, residuals(residuals) fxsize(43) ytitle("") ylabel(none) xlabel(, labsize(vsmall)) xtitle("CINC score", size(small)) scheme(s1mono) plotopts(msymbol(p) mcolor(gs9%40) recast(rline)) xscale(alt) ciop(fi(0) recast(rline) lpattern(dash) lcolor(black) lwidth(none)) title("Fractional polynomial", size(small) ring(0) pos(12)) saving(fracpoly_init5, replace)


fp <log_cinc>, scale replace: regress delta5_pr_overall_rank_A mzinit polity2 <log_cinc> pr_overall_rank_A geo2-geo5 majpow rgdpl

fp plot, fxsize(43) residuals(residuals) ytitle("") xtitle("CINC(ln)", size(small)) xlabel(, labsize(vsmall)) ylabel(none) scheme(s1mono) plotopts(msymbol(p) mcolor(gs9%40) recast(rline)) ciop(fi(0) recast(rline) lpattern(dash) lcolor(black) lwidth(none)) title("Fractional polynomial with log-transformed CINC", size(small) ring(0) pos(12)) saving(fracpoly_logged_init5, replace)


pspline delta5_pr_overall_rank_A cap mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, noknot fxsize(43) ytitle("") ylabel(none) d(2) noisily msymbol(p) mcolor(gs9%40) xscale(alt) xtitle("CINC score", size(small)) xlabel(0(.1).4, labsize(vsmall)) lineopts(lcolor(black) lpattern(solid)) scheme(s1mono) title("Penalized spline", size(small) ring(0) pos(12)) saving(pspline_init5, replace)

pspline delta5_pr_overall_rank_A log_cinc mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, noknot fxsize(43) ytitle("") xtitle("CINC(ln)", size(small)) ylabel(none) d(2) noisily msymbol(p) mcolor(gs9%40) xlabel(-15(5)0, labsize(vsmall)) lineopts(lcolor(black) lpattern(solid)) scheme(s1mono) title("Penalized spline with log-transformed CINC", size(small) ring(0) pos(12)) saving(pspline_logged_init5, replace)

gr combine linear_cpr_init5.gph fracpoly_init5.gph pspline_init5.gph logged_cpr_init5.gph fracpoly_logged_init5.gph pspline_logged_init5.gph, ycommon imargin(0 0 0 0 0 0) scheme(s1mono) title("{bf:Figure 9A:} Modeling non-linearity in the relationship between CINC and change in diplomatic rank", size(small) pos(7)) note("Note: Graphs above depict the predicted values of change in diplomatic rank over five years across different values of CINC, along with partial residuals, from six multivariate regression models. The linear graph is a component plus residual plot from" "Renshon's fully specified five-year MID initiation model. The log-linear graph is a component plus residual plot from the same model, but with the log-transformed version of CINC replacing the raw version. Graphs in the center column show" "component plus residual plots from fractional polnynomial models (with the log-transformed version of CINC replacing the raw version in the graph on the bottom). Graphs in the right-hand column are component plus residual plots from" "penalized spline models, with the bottom graph again including the log-transformed version of CINC. Red dashes in these graphs show knot locations.", size(tiny) span)


/* Figure 10A - replicates Figure 6 for the relationship between MID victory and change in diplomatic rank over five years */

regress delta5_pr_overall_rank_A cap winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

cprplot cap, scheme(s1mono) ylabel(, labsize(vsmall)) ytitle ("Change in diplomatic rank", size(small)) yscale(titlegap(*.5)) msymbol(p) mcolor(gs9%40) xlabel(0(.1).4, labsize(vsmall)) xtitle("CINC score", size(small)) xscale(alt) saving(linear_cpr_win5, replace) title("Linear", size(small) ring(0) pos(12))

regress delta5_pr_overall_rank_A log_cinc winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

cprplot log_cinc, scheme(s1mono) ylabel(, labsize(vsmall)) ytitle ("Change in diplomatic rank", size(small)) yscale(titlegap(*.5)) msymbol(p) xlabel(-15(5)0, labsize(vsmall)) xtitle("CINC(ln)", size(small)) mcolor(gs9%40) title("Log-linear", size(small) ring(0) pos(12)) saving(logged_cpr_win5, replace)


fp <cap>, replace: regress delta5_pr_overall_rank_A winlevel1 polity2 <cap> pr_overall_rank_A geo2-geo5 majpow rgdpl

fp plot, residuals(residuals) fxsize(43) ytitle("") ylabel(none) xlabel(, labsize(vsmall)) xtitle("CINC score", size(small)) scheme(s1mono) plotopts(msymbol(p) mcolor(gs9%40) recast(rline)) xscale(alt) ciop(fi(0) recast(rline) lpattern(dash) lcolor(black) lwidth(none)) title("Fractional polynomial", size(small) ring(0) pos(12)) saving(fracpoly_win5, replace)


fp <log_cinc>, scale replace: regress delta5_pr_overall_rank_A winlevel1 polity2 <log_cinc> pr_overall_rank_A geo2-geo5 majpow rgdpl

fp plot, fxsize(43) residuals(residuals) ytitle("") xtitle("CINC(ln)", size(small)) xlabel(, labsize(vsmall)) ylabel(none) scheme(s1mono) plotopts(msymbol(p) mcolor(gs9%40) recast(rline)) ciop(fi(0) recast(rline) lpattern(dash) lcolor(black) lwidth(none)) title("Fractional polynomial with log-transformed CINC", size(small) ring(0) pos(12)) saving(fracpoly_logged_win5, replace)


pspline delta5_pr_overall_rank_A cap winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, noknot fxsize(43) ytitle("") ylabel(none) d(2) noisily msymbol(p) mcolor(gs9%40) xscale(alt) xtitle("CINC score", size(small)) xlabel(0(.1).4, labsize(vsmall)) lineopts(lcolor(black) lpattern(solid)) scheme(s1mono) title("Penalized spline", size(small) ring(0) pos(12)) saving(pspline_win5, replace)

pspline delta5_pr_overall_rank_A log_cinc winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, noknot fxsize(43) ytitle("") xtitle("CINC(ln)", size(small)) ylabel(none) d(2) noisily msymbol(p) mcolor(gs9%40) xlabel(-15(5)0, labsize(vsmall)) lineopts(lcolor(black) lpattern(solid)) scheme(s1mono) title("Penalized spline with log-transformed CINC", size(small) ring(0) pos(12)) saving(pspline_logged_win5, replace)


gr combine linear_cpr_win5.gph fracpoly_win5.gph pspline_win5.gph logged_cpr_win5.gph fracpoly_logged_win5.gph pspline_logged_win5.gph, ycommon imargin(0 0 0 0 0 0) scheme(s1mono) title("{bf:Figure 10A:} Modeling non-linearity in the relationship between CINC and change in diplomatic rank", size(small) pos(7)) note("Note: Graphs above depict the predicted values of change in diplomatic rank over ten years across different values of CINC, along with partial residuals, from six multivariate regression models. The linear graph is a component plus residual plot from" "Renshon's fully specified five-year MID victory model. The log-linear graph is a component plus residual plot from the same model, but with the log-transformed version of CINC replacing the raw version. Graphs in the center column show" "component plus residual plots from fractional polnynomial models (with the log-transformed version of CINC replacing the raw version in the graph on the bottom). Graphs in the right-hand column are component plus residual plots from" "penalized spline models, with the bottom graph again including the log-transformed version of CINC. Red dashes in these graphs show knot locations.", size(tiny) span)


/* Figure 11A - replicates Figure 6 for the relationship between MID victory and change in diplomatic rank over ten years */

regress delta10_pr_overall_rank_A cap winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

cprplot cap, scheme(s1mono) ylabel(, labsize(vsmall)) ytitle ("Change in diplomatic rank", size(small)) yscale(titlegap(*.5)) msymbol(p) mcolor(gs9%40) xlabel(0(.1).4, labsize(vsmall)) xtitle("CINC score", size(small)) xscale(alt) saving(linear_cpr_win10, replace) title("Linear", size(small) ring(0) pos(12))

regress delta10_pr_overall_rank_A log_cinc winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

cprplot log_cinc, scheme(s1mono) ylabel(, labsize(vsmall)) ytitle ("Change in diplomatic rank", size(small)) yscale(titlegap(*.5)) msymbol(p) xlabel(-15(5)0, labsize(vsmall)) xtitle("CINC(ln)", size(small)) mcolor(gs9%40) title("Log-linear", size(small) ring(0) pos(12)) saving(logged_cpr_win10, replace)


fp <cap>, replace: regress delta10_pr_overall_rank_A winlevel1 polity2 <cap> pr_overall_rank_A geo2-geo5 majpow rgdpl

fp plot, residuals(residuals) fxsize(43) ytitle("") ylabel(none) xlabel(, labsize(vsmall)) xtitle("CINC score", size(small)) scheme(s1mono) plotopts(msymbol(p) mcolor(gs9%40) recast(rline)) xscale(alt) ciop(fi(0) recast(rline) lpattern(dash) lcolor(black) lwidth(none)) title("Fractional polynomial", size(small) ring(0) pos(12)) saving(fracpoly_win10, replace)


fp <log_cinc>, scale replace: regress delta10_pr_overall_rank_A winlevel1 polity2 <log_cinc> pr_overall_rank_A geo2-geo5 majpow rgdpl

fp plot, fxsize(43) residuals(residuals) ytitle("") xtitle("CINC(ln)", size(small)) xlabel(, labsize(vsmall)) ylabel(none) scheme(s1mono) plotopts(msymbol(p) mcolor(gs9%40) recast(rline)) ciop(fi(0) recast(rline) lpattern(dash) lcolor(black) lwidth(none)) title("Fractional polynomial with log-transformed CINC", size(small) ring(0) pos(12)) saving(fracpoly_logged_win10, replace)


pspline delta10_pr_overall_rank_A cap winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, noknot fxsize(43) ytitle("") ylabel(none) d(2) noisily msymbol(p) mcolor(gs9%40) xscale(alt) xtitle("CINC score", size(small)) xlabel(0(.1).4, labsize(vsmall)) lineopts(lcolor(black) lpattern(solid)) scheme(s1mono) title("Penalized spline", size(small) ring(0) pos(12)) saving(pspline_win10, replace)

pspline delta10_pr_overall_rank_A log_cinc winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl, noknot fxsize(43) ytitle("") xtitle("CINC(ln)", size(small)) ylabel(none) d(2) noisily msymbol(p) mcolor(gs9%40) xlabel(-15(5)0, labsize(vsmall)) lineopts(lcolor(black) lpattern(solid)) scheme(s1mono) title("Penalized spline with log-transformed CINC", size(small) ring(0) pos(12)) saving(pspline_logged_win10, replace)


gr combine linear_cpr_win10.gph fracpoly_win10.gph pspline_win10.gph logged_cpr_win10.gph fracpoly_logged_win10.gph pspline_logged_win10.gph, ycommon imargin(0 0 0 0 0 0) scheme(s1mono) title("{bf:Figure 11A:} Modeling non-linearity in the relationship between CINC and change in diplomatic rank", size(small) pos(7)) note("Note: Graphs above depict the predicted values of change in diplomatic rank over ten years across different values of CINC, along with partial residuals, from six multivariate regression models. The linear graph is a component plus residual plot from" "Renshon's fully specified ten-year MID victory model. The log-linear graph is a component plus residual plot from the same model, but with the log-transformed version of CINC replacing the raw version. Graphs in the center column show" "component plus residual plots from fractional polnynomial models (with the log-transformed version of CINC replacing the raw version in the graph on the bottom). Graphs in the right-hand column are component plus residual plots from" "penalized spline models, with the bottom graph again including the log-transformed version of CINC. Red dashes in these graphs show knot locations.", size(tiny) span)


/* Table 2A - displays results from models that allow for non-linearity in the relationships between the outcome and all continuous predictors (uses the user-written Stata packages mfpa and mvrs) */

mfpa: regress delta5_pr_overall_rank_A cap mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

est store mfp_init5

mfpa: regress delta10_pr_overall_rank_A cap mzinit polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

est store mfp_init10

mfpa: regress delta5_pr_overall_rank_A cap winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

est store mfp_win5

mfpa: regress delta10_pr_overall_rank_A cap winlevel1 polity2 pr_overall_rank_A geo2-geo5 majpow rgdpl

est store mfp_win10

mvrs: regress delta5_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl

est store mvrs_init5

mvrs: regress delta10_pr_overall_rank_A mzinit polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl

est store mvrs_init10

mvrs: regress delta5_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl

est store mvrs_win5

mvrs: regress delta10_pr_overall_rank_A winlevel1 polity2 cap pr_overall_rank_A geo2-geo5 majpow rgdpl

est store mvrs_win10

esttab mfp_init5 mvrs_init5 using Appendix_table.csv, nogaps nonotes coeflabels(mzinit "Initiation (5 years)") title ("Table X: Coefficients on conflict indicator from two multivariable approaches to modeling non-linearity in continuous predictors") eqlabels("") replace nonumbers keep(mzinit) se stats(aic bic) noli mtitles("Multivariable fractional polynomial" "Multivariate regression spline")

esttab mfp_init10 mvrs_init10 using Appendix_table.csv, nogaps nonotes append coeflabels(mzinit "Initiation (10 years)") eqlabels("") nonumbers keep(mzinit) se stats(aic bic) noli nomti

esttab mfp_win5 mvrs_win5 using Appendix_table.csv, append nogaps nonotes coeflabels(winlevel1 "Victory (5 years)") eqlabels("") nonumbers keep(winlevel1) se stats(aic bic) noli nomti

esttab mfp_win10 mvrs_win10 using Appendix_table.csv, append nogaps coeflabels(winlevel1 "Victory (10 years)") eqlabels("") nonumbers keep(winlevel1) se stats(aic bic) noli nomti addnotes("The Aikake and Bayesian Information Criteria are reported for each model as measures of goodness of fit.")

clear
